package com.xcw.bos.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xcw.bos.dao.IStaffDao;
import com.xcw.bos.domain.Staff;
import com.xcw.bos.page.PageBean;
import com.xcw.bos.service.IStaffService;
/**
 * 取派员操作Service
 * @author xcw
 *
 */
@Service
@Transactional
public class StaffServiceImpl implements IStaffService {

	@Autowired
	private IStaffDao staffDao;
	
	@Override
	public void save(Staff model) {
        staffDao.save(model);
	}

	@Override
	public void pageQuery(PageBean<Staff> pageBean) {
		staffDao.pageQuery(pageBean);

	}

	@Override
	public void delete(String ids) {
		String[] sids = ids.split(",");
		for (String id : sids){
			staffDao.executeByNamedQuery("deleteStaff",id);
		}

	}

	@Override
	public Staff findById(String id) {
		
		return staffDao.findById(id);
	}

	@Override
	public void update(Staff staff) {
		staffDao.update(staff);

	}
	
	public List<Staff> findByCondition(DetachedCriteria dc){
		return staffDao.findByCriteria(dc);
	}

}
